/**
 */
package usixmlcui.impl;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;

import usixmlcui.ConcreteGraphicalElementaryIU;
import usixmlcui.Label;
import usixmlcui.Usixml_cuiPackage;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Label</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link usixmlcui.impl.LabelImpl#getText <em>Text</em>}</li>
 *   <li>{@link usixmlcui.impl.LabelImpl#isWrapText <em>Wrap Text</em>}</li>
 *   <li>{@link usixmlcui.impl.LabelImpl#getNumberLines <em>Number Lines</em>}</li>
 *   <li>{@link usixmlcui.impl.LabelImpl#isIsEditable <em>Is Editable</em>}</li>
 *   <li>{@link usixmlcui.impl.LabelImpl#getEReference0 <em>EReference0</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class LabelImpl extends EObjectImpl implements Label {
	/**
	 * The default value of the '{@link #getText() <em>Text</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getText()
	 * @generated
	 * @ordered
	 */
	protected static final String TEXT_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getText() <em>Text</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getText()
	 * @generated
	 * @ordered
	 */
	protected String text = TEXT_EDEFAULT;

	/**
	 * The default value of the '{@link #isWrapText() <em>Wrap Text</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #isWrapText()
	 * @generated
	 * @ordered
	 */
	protected static final boolean WRAP_TEXT_EDEFAULT = false;

	/**
	 * The cached value of the '{@link #isWrapText() <em>Wrap Text</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #isWrapText()
	 * @generated
	 * @ordered
	 */
	protected boolean wrapText = WRAP_TEXT_EDEFAULT;

	/**
	 * The default value of the '{@link #getNumberLines() <em>Number Lines</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getNumberLines()
	 * @generated
	 * @ordered
	 */
	protected static final int NUMBER_LINES_EDEFAULT = 0;

	/**
	 * The cached value of the '{@link #getNumberLines() <em>Number Lines</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getNumberLines()
	 * @generated
	 * @ordered
	 */
	protected int numberLines = NUMBER_LINES_EDEFAULT;

	/**
	 * The default value of the '{@link #isIsEditable() <em>Is Editable</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #isIsEditable()
	 * @generated
	 * @ordered
	 */
	protected static final boolean IS_EDITABLE_EDEFAULT = false;

	/**
	 * The cached value of the '{@link #isIsEditable() <em>Is Editable</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #isIsEditable()
	 * @generated
	 * @ordered
	 */
	protected boolean isEditable = IS_EDITABLE_EDEFAULT;

	/**
	 * The cached value of the '{@link #getEReference0() <em>EReference0</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getEReference0()
	 * @generated
	 * @ordered
	 */
	protected ConcreteGraphicalElementaryIU eReference0;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected LabelImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected EClass eStaticClass() {
		return Usixml_cuiPackage.Literals.LABEL;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getText() {
		return text;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setText(String newText) {
		String oldText = text;
		text = newText;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, Usixml_cuiPackage.LABEL__TEXT, oldText, text));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean isWrapText() {
		return wrapText;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setWrapText(boolean newWrapText) {
		boolean oldWrapText = wrapText;
		wrapText = newWrapText;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, Usixml_cuiPackage.LABEL__WRAP_TEXT, oldWrapText, wrapText));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public int getNumberLines() {
		return numberLines;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setNumberLines(int newNumberLines) {
		int oldNumberLines = numberLines;
		numberLines = newNumberLines;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, Usixml_cuiPackage.LABEL__NUMBER_LINES, oldNumberLines, numberLines));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean isIsEditable() {
		return isEditable;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setIsEditable(boolean newIsEditable) {
		boolean oldIsEditable = isEditable;
		isEditable = newIsEditable;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, Usixml_cuiPackage.LABEL__IS_EDITABLE, oldIsEditable, isEditable));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ConcreteGraphicalElementaryIU getEReference0() {
		if (eReference0 != null && eReference0.eIsProxy()) {
			InternalEObject oldEReference0 = (InternalEObject)eReference0;
			eReference0 = (ConcreteGraphicalElementaryIU)eResolveProxy(oldEReference0);
			if (eReference0 != oldEReference0) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, Usixml_cuiPackage.LABEL__EREFERENCE0, oldEReference0, eReference0));
			}
		}
		return eReference0;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ConcreteGraphicalElementaryIU basicGetEReference0() {
		return eReference0;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setEReference0(ConcreteGraphicalElementaryIU newEReference0) {
		ConcreteGraphicalElementaryIU oldEReference0 = eReference0;
		eReference0 = newEReference0;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, Usixml_cuiPackage.LABEL__EREFERENCE0, oldEReference0, eReference0));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case Usixml_cuiPackage.LABEL__TEXT:
				return getText();
			case Usixml_cuiPackage.LABEL__WRAP_TEXT:
				return isWrapText() ? Boolean.TRUE : Boolean.FALSE;
			case Usixml_cuiPackage.LABEL__NUMBER_LINES:
				return new Integer(getNumberLines());
			case Usixml_cuiPackage.LABEL__IS_EDITABLE:
				return isIsEditable() ? Boolean.TRUE : Boolean.FALSE;
			case Usixml_cuiPackage.LABEL__EREFERENCE0:
				if (resolve) return getEReference0();
				return basicGetEReference0();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case Usixml_cuiPackage.LABEL__TEXT:
				setText((String)newValue);
				return;
			case Usixml_cuiPackage.LABEL__WRAP_TEXT:
				setWrapText(((Boolean)newValue).booleanValue());
				return;
			case Usixml_cuiPackage.LABEL__NUMBER_LINES:
				setNumberLines(((Integer)newValue).intValue());
				return;
			case Usixml_cuiPackage.LABEL__IS_EDITABLE:
				setIsEditable(((Boolean)newValue).booleanValue());
				return;
			case Usixml_cuiPackage.LABEL__EREFERENCE0:
				setEReference0((ConcreteGraphicalElementaryIU)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void eUnset(int featureID) {
		switch (featureID) {
			case Usixml_cuiPackage.LABEL__TEXT:
				setText(TEXT_EDEFAULT);
				return;
			case Usixml_cuiPackage.LABEL__WRAP_TEXT:
				setWrapText(WRAP_TEXT_EDEFAULT);
				return;
			case Usixml_cuiPackage.LABEL__NUMBER_LINES:
				setNumberLines(NUMBER_LINES_EDEFAULT);
				return;
			case Usixml_cuiPackage.LABEL__IS_EDITABLE:
				setIsEditable(IS_EDITABLE_EDEFAULT);
				return;
			case Usixml_cuiPackage.LABEL__EREFERENCE0:
				setEReference0((ConcreteGraphicalElementaryIU)null);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case Usixml_cuiPackage.LABEL__TEXT:
				return TEXT_EDEFAULT == null ? text != null : !TEXT_EDEFAULT.equals(text);
			case Usixml_cuiPackage.LABEL__WRAP_TEXT:
				return wrapText != WRAP_TEXT_EDEFAULT;
			case Usixml_cuiPackage.LABEL__NUMBER_LINES:
				return numberLines != NUMBER_LINES_EDEFAULT;
			case Usixml_cuiPackage.LABEL__IS_EDITABLE:
				return isEditable != IS_EDITABLE_EDEFAULT;
			case Usixml_cuiPackage.LABEL__EREFERENCE0:
				return eReference0 != null;
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (text: ");
		result.append(text);
		result.append(", wrapText: ");
		result.append(wrapText);
		result.append(", numberLines: ");
		result.append(numberLines);
		result.append(", isEditable: ");
		result.append(isEditable);
		result.append(')');
		return result.toString();
	}

} //LabelImpl
